<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>service创建自定义服务</title>
		<script src="../org/angular.min.js"></script>
		<script src="../org/jquery.min.js" ></script>
	</head>
	<body>
		<div ng-app="hd" ng-controller="ctrl">
			<table width="600" border="1px">
				<tr>
					<td>名称</td>
					<td>链接</td>
				</tr>
				<tr ng-repeat='v in data'>
					<td>{{v.name}}</td>
					<td>{{v.url}}</td>
				</tr>
			</table>
		</div>
		<script>
			var m = angular.module('hd',[]);
			m.service('serverHttp',['$http',function($http){
				    
					this.get=function(){
						return $http({method:'get',url:'$httpPhp.php'}).then(function(response){
							return response.data;
						})
					}
                    
				
			}]);
			m.controller('ctrl',['$scope','serverHttp',function($scope,serverHttp){
                serverHttp.get().then(function(data){
                	$scope.data = data;
                });
                
			}]);
		</script>
	</body>
</html>

